package com.mall.product.dto;

import com.mall.common.validator.group.*;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.hibernate.validator.constraints.URL;

import javax.validation.constraints.*;
import java.io.Serializable;


/**
 * 品牌
 *
 * @author xjc xjc@163.com
 * @since 1.0.0 2022-07-17
 */
@Data
@ApiModel(value = "品牌")
public class BrandDTO implements Serializable {
    private static final long serialVersionUID = 1L;

    @ApiModelProperty(value = "品牌id")
    @NotNull(message = "跟新不能没有id", groups = {UpdateGroup.class, UpdateStatusGroup.class})
    @Null(message = "新增不需要指定id", groups = {AddGroup.class})
    private Long brandId;

    @ApiModelProperty(value = "品牌名")
    @NotBlank(message = "品牌名不能为空",
            groups = {DefaultGroup.class,AddGroup.class,UpdateGroup.class})
    private String name;

    @ApiModelProperty(value = "品牌logo地址")
    @NotEmpty
    @URL(message = "logo 必须是一个有效的请求地址",
            groups = {DefaultGroup.class,AddGroup.class,UpdateGroup.class})
    private String logo;

    @ApiModelProperty(value = "介绍")
    private String descript;

    @ApiModelProperty(value = "显示状态[0-不显示；1-显示]")
    @FieldStatus(values = {0,1},message = "必须提交指点的值",
            groups = {AddGroup.class,UpdateGroup.class, UpdateStatusGroup.class})
    private Integer showStatus;

    @ApiModelProperty(value = "检索首字母")
    @Pattern(regexp = "^[a-zA-Z]$", message = "检索首字母必须是单个字母",
            groups = {DefaultGroup.class,AddGroup.class,UpdateGroup.class})
    private String firstLetter;

    @ApiModelProperty(value = "排序")
    @Min(value = 0, message = "排序值不能小于0",groups = {DefaultGroup.class,AddGroup.class,UpdateGroup.class})
    private Integer sort;


}